﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<div class="x-sidemenu x-theme-draft" style="display: inline;">
  <ul class="nav nav-stacked x-sidebar" role="tablist">
    <c:forEach var="menu" items="${secure.submenus[activeMenu]}">
      <c:if test="${currentPrincipal.hasResource('submenus', menu.id)}">
        <li class="presentation" role="preparation"><a href="javascript:void(0);" class="" style="display: block; padding-left: 33px;"> <span class="iconfont icon-lingxing" style="position: absolute; width: 16px; left: 10px; top: 6px; height: 22px;"></span><strong>${menu.name}</strong>
        </a>
          <ul class="subnav list-unstyled">
            <c:forEach var="submenu" items="${menu.submenus}">
              <c:if test="${currentPrincipal.hasResource('submenus', submenu.id)}">
                <c:choose>
                  <c:when test="${not empty submenu.submenus}">
                    <li class="presentation" role="preparation"><a href="javascript:void(0);" class=""><span class="caret"></span>${submenu.name}</a>
                      <ul class="subnav list-unstyled">
                        <c:forEach var="ssmenu" items="${submenu.submenus}">
                          <li class="${menuContext.shouldHighlight(ssmenu.id) ? 'active' : ''}"><c:choose>
                              <c:when test="${not empty param.contextPath}">
                                <a href="${param.contextPath}/${ssmenu.url}" title="${ssmenu.description}">${ssmenu.name}</a>
                              </c:when>
                              <c:otherwise>
                                <a href="${ctx.host}/${ssmenu.url}" title="${ssmenu.description}">${ssmenu.name}</a>
                              </c:otherwise>
                            </c:choose></li>
                        </c:forEach>
                      </ul></li>
                  </c:when>
                  <c:otherwise>
                    <li class="${menuContext.shouldHighlight(submenu.id) ? 'active' : ''}"><c:choose>
                        <c:when test="${not empty param.contextPath}">
                          <a href="${param.contextPath}/${param.currentUrl}/${submenu.url}" title="${submenu.description}">${submenu.name}</a>
                        </c:when>
                        <c:otherwise>
                          <a href="${ctx.host}/${submenu.url}" title="${submenu.description}">${submenu.name}</a>
                        </c:otherwise>
                      </c:choose></li>
                  </c:otherwise>
                </c:choose>
              </c:if>
            </c:forEach>
          </ul></li>
      </c:if>
    </c:forEach>
  </ul>
</div>

